#!/usr/bin/env bash
export HOST1=172.16.100.36
export HOST2=172.16.100.37
export HOST3=172.16.100.38
export USER=root

kubeadm_join=`kubeadm token create --print-join-command`
for HOST in ${HOST2} ${HOST3}
do
  ssh ${USER}@${HOST} mkdir -p /etc/kubernetes/
  scp -r /etc/kubernetes/pki ${USER}@${HOST}:/etc/kubernetes/
  ssh ${USER}@${HOST} 'curl -s https://gitee.com/hewei8520/File/raw/master/1.13.5/base-env-config-multi-node.sh |bash'
  ssh ${USER}@${HOST} 'curl -s https://gitee.com/hewei8520/File/raw/master/1.13.5/systemd.sh |bash'
  ssh ${USER}@${HOST} '${kubeadm_join}'
done
